nlp_architect.data.cdc_resources.relations.verbocean_relation_extraction.VerboceanRelationExtraction

class nlp_architect.data.cdc_resources.relations.verbocean_relation_extraction.VerboceanRelationExtraction(method: nlp_architect.data.cdc_resources.relations.relation_types_enums.OnlineOROfflineMethod = <OnlineOROfflineMethod.ONLINE: 'online'>, vo_file: str = None)[source]
__init__(method: nlp_architect.data.cdc_resources.relations.relation_types_enums.OnlineOROfflineMethod = <OnlineOROfflineMethod.ONLINE: 'online'>, vo_file: str = None)[source]

Extract Relation between two mentions according to VerbOcean knowledge

Parameters
  • method (optional) – OnlineOROfflineMethod.{ONLINE/OFFLINE} run against full VerbOcean or a sub-set of it (default = ONLINE)

  • vo_file (required) – str Location of VerbOcean file to work with

Methods

__init__(method, vo_file)

Extract Relation between two mentions according to VerbOcean knowledge

extract_all_relations(mention_x, mention_y)

extract_relation(mention_x, mention_y, relation)

Base Class Check if Sub class support given relation before executing the sub class

extract_sub_relations(mention_x, mention_y, …)

Check if input mentions has the given relation between them

get_supported_relations()

Return all supported relations by this class

is_verbocean_relation(mention_x, mention_y)

Check if input mentions has VerbOcean relation between them

load_verbocean_file(fname)

Method to load referent dictionary to memory

extract_all_relations(mention_x: nlp_architect.common.cdc.mention_data.MentionDataLight, mention_y: nlp_architect.common.cdc.mention_data.MentionDataLight) → Set[nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType][source]
extract_relation(mention_x: nlp_architect.common.cdc.mention_data.MentionDataLight, mention_y: nlp_architect.common.cdc.mention_data.MentionDataLight, relation: nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType) → nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType

Base Class Check if Sub class support given relation before executing the sub class

Parameters
  • mention_x – MentionDataLight

  • mention_y – MentionDataLight

  • relation – RelationType

Returns

relation in case mentions has given relation and

RelationType.NO_RELATION_FOUND otherwise

Return type

RelationType

extract_sub_relations(mention_x: nlp_architect.common.cdc.mention_data.MentionDataLight, mention_y: nlp_architect.common.cdc.mention_data.MentionDataLight, relation: nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType) → nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType[source]

Check if input mentions has the given relation between them

Parameters
  • mention_x – MentionDataLight

  • mention_y – MentionDataLight

  • relation – RelationType

Returns

relation in case mentions has given relation or

RelationType.NO_RELATION_FOUND otherwise

Return type

RelationType

static get_supported_relations()[source]

Return all supported relations by this class

Returns

List[RelationType]

is_verbocean_relation(mention_x: nlp_architect.common.cdc.mention_data.MentionDataLight, mention_y: nlp_architect.common.cdc.mention_data.MentionDataLight) → bool[source]

Check if input mentions has VerbOcean relation between them

Parameters
  • mention_x – MentionDataLight

  • mention_y – MentionDataLight

Returns

bool

static load_verbocean_file(fname: str) → Dict[str, Dict[str, str]][source]

Method to load referent dictionary to memory

Returns

List[RelationType]